import { createRouter, createWebHistory } from 'vue-router'
import Layout from "@/views/layout/index.vue"

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      name: 'login',
      hidden: true, // 不显示在左侧菜单
      component: () => import('@/views/login/index.vue')
    },
    {
      path: '/',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: Layout,
      redirect: '/dashboard',
      children: [
        {
          path: '/dashboard',
          component: () => import('@/views/dashboard/index.vue'),
          meta: {
            // 路由元信息 专门存储自定义属性的位置
            title: '首页',
            icon: 'DesktopOutlined'
          }
        }
      ]
    },
   
    {
      path: '/park',
      component: Layout,
      meta: {
        title: '园区管理',
        icon: 'LockOutlined'
      },
      children: [
        {
          path: '/park/build',
          component: () => import('@/views/park/build.vue'),
          meta: {
            title: '楼宇管理'
          }
        },
        {
          path: '/park/company',
          component: () => import('@/views/park/company.vue'),
          meta: {
            title: '企业管理'
          }
        }
      ]
    },
    // 行车管理
    {
      path: '/car',
      component: Layout,
      meta: {
        title: '行车管理',
        icon: 'CarOutlined'

      },
      children: [
        {
          path: '/car/area', // 二级路由的path什么都不写表示它是默认二级路由
          component: () => import('@/views/car/area.vue'),
          meta: {
            title: '区域管理',
          }
        },
        {
          path: '/car/card', // 二级路由的path什么都不写表示它是默认二级路由
          component: () => import('@/views/car/card.vue'),
          meta: {
            title: '月卡管理',
          }
        },
        {
          path: '/car/fee', // 二级路由的path什么都不写表示它是默认二级路由
          component: () => import('@/views/car/fee.vue'),
          meta: {
            title: '停车缴费管理',
          }
        },
        {
          path: '/car/feerules', // 二级路由的path什么都不写表示它是默认二级路由
          component: () => import('@/views/car/feerules.vue'),
          meta: {
            title: '计费规则管理',
          }
        },
      ]
    },
    // 物业费管理
    {
      path: '/profee',
      component: Layout,
      meta: {
        title: '物业费管理',
        icon: 'AccountBookOutlined'
      },
      children: [
        {
          path: '', // 二级路由的path什么都不写表示它是默认二级路由
          component: () => import('@/views/profee/propertyfee.vue'),
          meta: {
            title: '物业费管理',
        icon: 'AccountBookOutlined'

          }
        }
      ]
    },
    // 一体杆管理
    {
      path: '/rod',
      component: Layout,
      meta: {
        title: '一体杆管理',
        icon: 'DashboardOutlined'
      },
      children: [
        {
          path: '/rod/wholerod',
          component: () => import('@/views/rod/wholerod.vue'),
          meta: {
            title: '一体杆管理'
          }
        },
        {
          path: '/rod/alarm',
          component: () => import('@/views/rod/alarm.vue'),
          meta: {
            title: '告警记录'
          }
        }
      ]
    },
    // 系统管理
    {
      path: '/system',
      component: Layout,
      meta: {
        title: '系统管理',
        icon: 'UsergroupAddOutlined'
      },
      children: [
        {
          path: '/system/employee',
          component: () => import('@/views/system/employee.vue'),
          meta: {
            title: '员工管理'
          }
        },
        {
          path: '/system/role',
          component: () => import('@/views/system/roles.vue'),
          meta: {
            title: '角色管理'
          }
        }
      ]
    },
    
  ]
})

export default router
